//https://blog.csdn.net/zl1zl2zl3/article/details/81357146
import React, {
	PureComponent,
	Fragment
} from 'react';
import { connect } from 'dva';
import moment from 'moment';
import router from 'umi/router';
import { getNodeByNameAndCallbackProcess } from '@/components/_utils/algorithmTools';
import {
	Row,
	Col,
	Card,
	Form,
	Input,
	Select,
	Icon,
	Button,
	Modal,
	message,
	Divider,
	Table,
	DatePicker,
	Steps,
	Dropdown,
	Menu,
	Tabs
} from 'antd';
//import StandardTable from '@/components/StandardTable';
import SelectPoliceRankTree from '@/components/SelectPoliceRankTree';
import SelectDutyLevelTree from '@/components/SelectDutyLevelTree';
import SelectWorkTree from '@/components/SelectWorkTree';
import SelectChangeTypeTree from '@/components/SelectChangeTypeTree';
import PageHeaderWrapper from '@/components/PageHeaderWrapper';

import ProUserCreateForm from './ProUserCreateForm';//新增表单
import ProUserUpdateForm from './ProUserUpdateForm';//修改表单
import ProUserViewForm from './ProUserViewForm';//查看表单



import SystemSelectModal from './SystemSelectModal';//系统筛选
import IdentifyInfoModal from './IdentifyInfoModal';//鉴定信息录入
import ApplicationModal from './ApplicationModal';//生成请示花名册
import MemberApproveModal from './MemberApproveModal';//生成审批表


import styles from './ProUserList.less';
import {getValue} from '@/utils/globalcommon';
import {initTotalList} from '@/utils/globalcommon';
const FormItem = Form.Item;
const { Option } = Select;
const { confirm } = Modal;
const { Step } = Steps;
const { TabPane } = Tabs;

//用户列表

class StandardTable extends PureComponent {

  constructor(props) {
    super(props);
    const { columns } = props;
    const needTotalList = initTotalList(columns);

    this.state = {
      selectedRowKeys: [],
      needTotalList,
    };
  }

  static getDerivedStateFromProps(nextProps) {
    // clean state
    if (nextProps.selectedRows.length === 0) {
      const needTotalList = initTotalList(nextProps.columns);
      return {
        selectedRowKeys: [],
        needTotalList,
      };
    }
    return null;
  }

  handleRowSelectChange = (selectedRowKeys, selectedRows) => {
    let { needTotalList } = this.state;
    needTotalList = needTotalList.map(item => ({
      ...item,
      total: selectedRows.reduce((sum, val) => sum + parseFloat(val[item.dataIndex], 10), 0),
    }));
    const { onSelectRow } = this.props;
    if (onSelectRow) {
      onSelectRow(selectedRows);
    }

    this.setState({ selectedRowKeys, needTotalList });
  };

  handleTableChange = (pagination, filters, sorter) => {
    const { onChange } = this.props;
    if (onChange) {
      onChange(pagination, filters, sorter);
    }
  };

  cleanSelectedKeys = () => {
    this.handleRowSelectChange([], []);
  };

  setClassName = (record, index) => {
    console.log(record);
  	const { checkflag } = this.props;
    console.log(checkflag);
    return ( record.serial_number == 3 && checkflag ? styles.staffTableRow : '')
  }

  render() {
    const { selectedRowKeys, needTotalList } = this.state;
    console.log(this.props);
    const { data = {}, rowKey, ...rest } = this.props;
    const { list = [], pagination } = data;

    const paginationProps = {
      showSizeChanger: true,
      showQuickJumper: true,
      // current:pagination? pagination.currentPage : 1,
      // ...pagination,
    };

    const rowSelection = {
      selectedRowKeys,
      onChange: this.handleRowSelectChange,
      getCheckboxProps: record => ({
        disabled: record.disabled,
      }),
    };

    return (
      <div className={styles.standardTable}>
        <Table
          rowKey={rowKey || 'key'}
          rowSelection={rowSelection}
          dataSource={data}
          pagination={paginationProps}
          onChange={this.handleTableChange}
          rowClassName={this.setClassName}
          {...rest}
          size="middle"
          scroll={{x: 'max-content'}}
        />
      </div>
    );
  }
}
let selectNum = 0;
let batchName;
let batchName_two;
let batchName_three;
/* eslint react/no-multi-comp:0 */
@connect(({
	propoliceselect,
	loading
}) => ({
	propoliceselect,
	loading: loading.models.propoliceselect,
}))
@Form.create()
class ProStaffSelectList extends PureComponent {
	state = {
		modalVisible: false,
		updateModalVisible: false,
		viewModalVisible: false,
		expandForm: false,
		selectedRows: [],
		formValues: {},
		updateFormValues: {},
		viewFormValues: {},
		requestModelName:"propoliceselect",
		currentPage: 1,
		pageSize: 10,

		current: 0,
		modalVisibleBySystemSelect: false,
		modalVisibleByIdentifyInfo: false,
		modalVisibleByApplication: false,
		modalVisibleByMemberApprove: false,
		modalByCheck: false,
		checkflag: false,
		getPoliceRankTreeBySelectTree: "",
		getDutyLevelTreeBySelectTree: "",
		getWorkTreeBySelectTree: "",
		getChangeTypeTreeBySelectTree: "",
		resetFlag: false,
    statusFlag: 1,
	};


	//审批表
	handleModalVisibleByMemberApprove = flag => {
		const { selectedRows } = this.state;
		if(selectedRows.length > 0) {
			this.setState({
				modalVisibleByMemberApprove: !!flag,
			});
			if(flag) {
				message.success('生成成功');
				this.setState({
					current: 4,
				});
			}
		}else {
			Modal.warning({
			    title: '请选择一条记录',
			    okText: '确认',
			    centered: true,
			});
		}

	};

	handleAddByMemberApprove = () => {
		const { dispatch } = this.props;

		this.handleModalVisibleByMemberApprove();

	};

	setClassName = (record, index) => {
	  return ( index  === 0 ? styles.red : '')
	}

	//系统筛选
	handleModalVisibleBySystemSelect = flag => {
		this.setState({
			modalVisibleBySystemSelect: !!flag,
		});
	};

	handleAddBySystemSelect = (fieldsValue) => {
		const { dispatch } = this.props;
//		form.resetFields();

		this.setState({
			selectedRows: [],
			current: 1,
			checkflag: false,
		});
    selectNum += 1;
    if(selectNum == 1) {
      batchName = fieldsValue.batch_name || "内蒙古兴安盟公安局";
    }else if(selectNum == 2) {
      batchName_two = fieldsValue.batch_name || "武某";
    }else if(selectNum == 3) {
       batchName_three = fieldsValue.batch_name || "内蒙古呼和浩特公安局";
    }
		dispatch({
			type: 'propoliceselect/query_page_for_policeselect',
			payload: {
				person: fieldsValue.person,
				company: fieldsValue.company,
        batchname: batchName,
        batchnametwo: batchName_two,
        batchnamethree: batchName_three,
        selectnum: selectNum
			},
		});
		this.handleModalVisibleBySystemSelect();

	};
	//录入鉴定信息
	handleModalVisibleByIdentifyInfo = flag => {
		const { selectedRows } = this.state;
    let statusFlag = true;
    const _this = this;
		if(selectedRows.length > 0) {
      for(let i = 0;i < selectedRows.length;i++) {
         if(selectedRows[i].status != 3) {
              statusFlag = false;
              break;
         }
      }
      if(statusFlag) {

        this.setState({
        	modalVisibleByIdentifyInfo: !!flag,
        });
      }else {
          confirm({
              title: '存在未核查信息确认要录入鉴定信息吗?',
              okText: '确认',
              cancelText: '取消',
              centered: true,
              onOk() {
                _this.setState({
                	modalVisibleByIdentifyInfo: !!flag,
                });
              },
              onCancel() {},
          });
      }
		}else {
			Modal.warning({
			    title: '请选择记录',
			    okText: '确认',
			    centered: true,
			});
		}
	};

	handleAddByIdentifyInfo = () => {
		const { dispatch } = this.props;

		this.setState({
			current: 3,
		});
		message.success('录入成功');

		this.handleModalVisibleByIdentifyInfo();

	};
	//生成请示花名册
	handleModalVisibleByApplication = flag => {
		const { selectedRows } = this.state;
		if(selectedRows.length > 0) {
			this.setState({
				modalVisibleByApplication: !!flag,
			});
			if(flag) {
				message.success('生成成功');
				this.setState({
					current: 4,
				});
			}
		}else {
			Modal.warning({
			    title: '请选择一条记录',
			    okText: '确认',
			    centered: true,
			});
		}
	};


	handleAddByApplication = () => {
		const { dispatch } = this.props;


		this.handleModalVisibleByApplication();

	};
	//核查
	handleModalVisibleByCheck = flag => {
		const { selectedRows } = this.state;
    console.log(selectedRows);
		const _this = this;
    const { dispatch } = this.props;
    let statusFlag2;
    let statusFlag3;
    this.setState({
      statusFlag: 3
    })
		if(selectedRows.length > 0) {
      for(let i = 0;i < selectedRows.length;i++) {
         if(selectedRows[i].status == 2) {
              statusFlag2 = true;
              break;
         }
         if(selectedRows[i].name == "武某") {
              statusFlag3 = true;
         }
      }
      if(statusFlag2) {
          confirm({
              title: '1条信息不准确是否查看?',
              okText: '确认',
              cancelText: '取消',
              centered: true,
              onOk() {
          		_this.handleModalByCheck(true);
              },
              onCancel() {},
          });
          _this.setState({
          	current: 1,
          	checkflag: true
          });
      }else {
         Modal.success({
             title: '核查通过',
             okText: '确认',
             centered: true,
             onOk() {
         		_this.setState({
         			current: 2,
         		});
             },
             onCancel() {},
         });
          if(statusFlag3) {
            dispatch({
            	type: 'propoliceselect/query_page_for_policeselect',
              payload: {
                status: 3,
                status3: 3,
                selectnum: selectNum,
                batchname: batchName,
                batchnametwo: batchName_two,
                batchnamethree: batchName_three,
                parentid: "one"
              }
            });
          }else {
              dispatch({
              	type: 'propoliceselect/query_page_for_policeselect',
                payload: {
                  status: 3,
                  status3: 1,
                  selectnum: selectNum,
                  batchname: batchName,
                  batchnametwo: batchName_two,
                  batchnamethree: batchName_three,
                }
              });
          }
         _this.setState({
         	current: 1,
         	checkflag: false,
           selectedRows: [],
         });
      }
		}else {
			Modal.warning({
			    title: '请选择记录',
			    okText: '确认',
			    centered: true,
			});
		}

	};

	handleModalByCheck = flag => {
		this.setState({
			modalByCheck: !!flag,
		});
	};

	//确定人员
	handleModalVisibleByDefinedMember = flag => {
		const { selectedRows } = this.state;
		const _this = this;
    let statusFlag = true;
    const { dispatch } = this.props;

		if(selectedRows.length > 0) {
        for(let i = 0;i < selectedRows.length;i++) {
           if(selectedRows[i].status != 3) {
                statusFlag = false;
                break;
           }
        }
        if(statusFlag) {
            Modal.success({
                title: '提交成功',
                content: '提交结果可在数据上报中查看',
                okText: '确认',
                centered: true,
                onOk() {

                },
                onCancel() {},
            });
            dispatch({
            	type: 'propoliceselect/query_page_for_policeselect',
              payload: {
                status: this.state.statusFlag,
                selectnum: selectNum,
                batchname: batchName,
                batchnametwo: batchName_two,
                batchnamethree: batchName_three,
                parentid: selectedRows[0].parentid
              }
            });
            _this.setState({
              selectedRows: [],
            });
        }else {
            confirm({
                title: '存在未核查信息确认提交吗?',
                okText: '确认',
                cancelText: '取消',
                centered: true,
                onOk() {
                    dispatch({
                    	type: 'propoliceselect/query_page_for_policeselect',
                      payload: {
                        status: _this.state.statusFlag,
                        selectnum: selectNum,
                        batchname: batchName,
                        batchnametwo: batchName_two,
                        batchnamethree: batchName_three,
                        parentid: selectedRows[0].parentid
                      }
                    });
                     _this.setState({
                       selectedRows: [],
                     });
                    Modal.success({
                        title: '提交成功',
                        content: '提交结果可在数据上报中查看',
                        okText: '确认',
                        centered: true,
                        onOk() {

                        },
                        onCancel() {},
                    });
                },
                onCancel() {},
            });
        }

		}else {
			Modal.warning({
			    title: '请选择人员',
			    okText: '确认',
			    centered: true,
			});
		}

	};


	columns = [
        // {
        //   title: '序号',
        //   dataIndex: 'serial_number',
        //   key: 'serial_number',
        // },
        {
	        title: '单位',
	        dataIndex: 'unit',
	        key: 'unit',
        }, 	{
	        title: '姓名',
	        dataIndex: 'name',
	        key: 'name',
        },  {
	        title: '性别',
	        dataIndex: 'sex',
	        key: 'sex',
        },  {
	        title: '出生日期',
	        dataIndex: 'date_of_birth',
	        key: 'date_of_birth',
        },  {
	        title: '状态',
	        dataIndex: 'status',
	        key: 'status',
          render: (text,record) => {
              if(record.status == 1) {
                return <span style={{color: "red"}}>未核查</span>
              }else if(record.status == 3) {
                return <span style={{color: "green"}}>已核查</span>
              }else if(record.status == 2) {
                return <span style={{color: "red"}}>核查失败</span>
              }
          }
        },{
	        title: '参加工作时间',
	        dataIndex: 'working_hours',
	        key: 'working_hours',
        },  {
	        title: '学制年限',
	        dataIndex: 'educational_system',
	        key: 'educational_system',
        }, {
	        title: '职务',
	        dataIndex: 'post',
	        key: 'post',
        }, {
	        title: '职务层次',
	        dataIndex: 'duty_level',
	        key: 'duty_level',
        }, {
	        title: '任职时间',
	        dataIndex: 'appointment_time',
	        key: 'appointment_time',
        },{
	        title: '变动类型',
	        dataIndex: 'change_type',
	        key: 'change_type',
        },{
	        title: '现任警衔',
	        dataIndex: 'incumbent_police_rank',
	        key: 'incumbent_police_rank',
        },{
	        title: '现任警衔起算日期',
	        dataIndex: 'start_time',
	        key: 'start_time',
        },{
	        title: '拟授警衔',
	        dataIndex: 'police_rank',
	        key: 'police_rank',
        },{
	        title: '新警衔起算日期',
	        dataIndex: 'new_start_time',
	        key: 'new_start_time',
        },{
            title: '操作',
            fixed:'right',
            align: 'center',
            width: 160,
            render: (text, record) => {
                  const { updateButtonVisible,deleteButtonVisible } = this.state;
                  return (
                    <Fragment>

                  {/*<a onClick={() => this.handleViewModalVisible(true, record)}>查看</a>
                  <Divider type="vertical" />*/}
                  <Button  type="primary"  icon="eye"  style={{marginRight: '5px'}} onClick={() => router.push('/policerank/viewstaff')}></Button>
                  <Divider type="vertical" />
                  <Button  type="danger" icon="delete" onClick={() => this.handleDeleteRecord(record)}></Button>

                  </Fragment>
                  );

            }
		},
	];

	columnsByCheck = [
		{
	        title: '序号',
	        dataIndex: 'index',
	        key: 'index',
        },  {
	        title: '姓名',
	        dataIndex: 'name',
	        key: 'name',
        }, 	{
	        title: '核查结果',
	        dataIndex: 'check_result',
	        key: 'check_result',
        },
	];

	componentDidMount() {
		const { dispatch } = this.props;
		dispatch({
			type: 'propoliceselect/query_page_for_policeselect',
      payload: {
        pcmc: "didfdfdfd"
      }
		});
	}

	handleStandardTableChange = (pagination, filtersArg, sorter) => {
		const { dispatch } = this.props;
		const { formValues } = this.state;

		this.setState({
			currentPage: pagination.current,
			pageSize: pagination.pageSize,
			selectedRows: [],
		})

		const filters = Object.keys(filtersArg).reduce((obj, key) => {
			const newObj = { ...obj
			};
			newObj[key] = getValue(filtersArg[key]);
			return newObj;
		}, {});

		const params = {
			currentPage: pagination.current,
			pageSize: pagination.pageSize,
			...formValues,
			...filters,
		};
		if(sorter.field) {
			params.sorter = `${sorter.field}_${sorter.order}`;
		}

		// dispatch({
		// 	type: 'propoliceselect/query_page_for_policeselect',
		// 	payload: params,
		// });
	};

	previewItem = id => {
		router.push(`/profile/basic/${id}`);
	};

	handleFormReset = () => {
		const { form,dispatch } = this.props;
		form.resetFields();

		this.setState({
			formValues: {},
			currentPage:1,
			selectedRows: [],
			resetFlag: true,
			getPoliceRankTreeBySelectTree: "",
			getDutyLevelTreeBySelectTree: "",
			getWorkTreeBySelectTree: "",
			getChangeTypeTreeBySelectTree: "",
		});
		dispatch({
			type: 'propoliceselect/query_page_for_policeselect',
		});
	};

	toggleForm = () => {
		const { expandForm } = this.state;
		this.setState({
			expandForm: !expandForm,
		});
	};

	//选中人员
	handleSelectRows = rows => {
		this.setState({
			selectedRows: rows,
		});
	};

	handleSearch = e => {
		e.preventDefault();

		const {
			dispatch,
			form
		} = this.props;

		form.validateFields((err, fieldsValue) => {
			if(err) return;


			const { getPoliceRankTreeBySelectTree,getDutyLevelTreeBySelectTree,getWorkTreeBySelectTree,getChangeTypeTreeBySelectTree } = this.state;
		      if (getPoliceRankTreeBySelectTree) {
		        fieldsValue.police_rank = getPoliceRankTreeBySelectTree.triggerNode.props.dataRef.title;
		      }

		      if (getDutyLevelTreeBySelectTree) {
		        fieldsValue.duty_level = getDutyLevelTreeBySelectTree.triggerNode.props.dataRef.title;
		      }

		      if (getWorkTreeBySelectTree) {
		        fieldsValue.company = getWorkTreeBySelectTree.triggerNode.props.dataRef.title;
		      }

		      if (getChangeTypeTreeBySelectTree) {
		        fieldsValue.change_type = getChangeTypeTreeBySelectTree.triggerNode.props.dataRef.title;
		      }

			const values = {
				...fieldsValue,
				updatedAt: fieldsValue.updatedAt && fieldsValue.updatedAt.valueOf(),
			};

			this.setState({
				currentPage:1,
				selectedRows: [],
				formValues: values,
				resetFlag: false
			});

			dispatch({
				type: 'propoliceselect/query_page_for_policeselect',
				payload: values,
			});
		});
	};

	handleModalVisible = flag => {
		this.setState({
			modalVisible: !!flag,
		});
	};

	handleUpdateModalVisible = (flag, record) => {
		this.setState({
			updateModalVisible: !!flag,
			updateFormValues: record || {},
		});
	};

	handleViewModalVisible = (flag, record) => {
		this.setState({
			viewModalVisible: !!flag,
			viewFormValues: record || {},
		});
	};

	handleAdd = fields => {
		const { dispatch } = this.props;

		dispatch({
			type: 'prouser/insert_for_prouser',
			payload: {
				user_name: fields.user_name,
				user_name_cn: fields.user_name_cn,
				password: fields.password,
				email: fields.email,
				phone: fields.phone,
				auth_ids: fields.auth_ids,
				dept_id: fields.dept_id,
				dept: fields.dept,
				post_id: fields.post_id,
				post_name: fields.post_name,
				enabled: fields.enabled,

				is_system_user: fields.is_system_user,
				creator_id: fields.creator_id,
				inner_dept_code: fields.inner_dept_code,
				org_code: fields.org_code,
				org: fields.org,
				inner_org_code: fields.inner_org_code,
				memos: fields.memos,
				avatar: fields.avatar,
				job: fields.job,
				createTime: fields.createTime,
			},
			callback:(res) => {
	        	if(res.success) {
					message.success('添加成功');
	        	}else {
        			message.success('添加失败');
	        	}
  			}
		});

		this.setState({
				selectedRows: [],
		});

		this.handleModalVisible();

	};


	handleUpdate = fields => {

		const { dispatch } = this.props;
		const { currentPage,pageSize } = this.state;
		dispatch({
			type: 'prouser/update_for_prouser',
			payload: {
				user_id: fields.user_id,
				user_name: fields.user_name,
				user_name_cn: fields.user_name_cn,
				password: fields.password,
				email: fields.email,
				phone: fields.phone,
				auth_ids: fields.auth_ids,
				dept_id: fields.dept_id,
				dept: fields.dept,
				post_id: fields.post_id,
				post_name: fields.post_name,
				enabled: fields.enabled,
				currentPage,
        		pageSize
			},
			callback:(res) => {
	        	if(res.success) {
					message.success('修改成功');
	        	}else {
        			message.success('修改失败');
	        	}
      		}
		});

		this.setState({
			selectedRows: [],
		});

		this.handleUpdateModalVisible();

	};

	handleDeleteRecord = record => {
		const { dispatch } = this.props;
		const { currentPage,pageSize,dataSource } = this.state;
    const _this = this;
		confirm({
	    title: '您确定要删除此人员吗?',
	    okText: '确认',
	    cancelText: '取消',
	    onOk() {
        dispatch({
        	type: 'propoliceselect/query_page_for_policeselect',
        	payload: {
        		person: fieldsValue.person,
        	},
        });
	    },
	    onCancel() {},
	  });

	  this.setState({
			selectedRows: [],
	   });

	};
	//拟授警衔
	selectedPoliceRankTreeValue = (deptRecord) => {
		  this.setState({
  			getPoliceRankTreeBySelectTree: deptRecord,
  		})
	}

	//职务层次
	selectedDutyLevelTreeValue = (deptRecord) => {
		  this.setState({
  			getDutyLevelTreeBySelectTree: deptRecord,
  		})
	}

	//单位
	selectedWorkTreeValue = (deptRecord) => {
		  this.setState({
  			getWorkTreeBySelectTree: deptRecord,
  		})
	}

	//变动类型
	selectedChangeTypeTreeValue = (deptRecord) => {
		  this.setState({
  			getChangeTypeTreeBySelectTree: deptRecord,
  		})
	}

	renderSimpleForm() {
		const {
			form: {
				getFieldDecorator
			},
			propoliceselect: {
				selectPoliceRankTree
			},
		} = this.props;
		const parentPoliceRankTreeMethod = {
			dispatch: this.props.dispatch,
			requestModelName: this.state.requestModelName,
			selectedPoliceRankTreeValue: this.selectedPoliceRankTreeValue,
			selectPoliceRankTree,
			resetFlag: this.state.resetFlag
		}
		return(
		<Form onSubmit={this.handleSearch} layout="inline">
	      <Row gutter={{ md: 8, lg: 24, xl: 48 }}>
					<Col md={8} sm={24}>
			        <FormItem label="姓名">
			        	{getFieldDecorator('name')(<Input placeholder="请输入" />)}
							</FormItem>
			    </Col>
		      <Col md={8} sm={24}>
			        <FormItem label="拟授警衔">
			        	{getFieldDecorator('police_rank')(<SelectPoliceRankTree  {...parentPoliceRankTreeMethod}/>)}
							</FormItem>
		    	</Col>
			    <Col md={8} sm={24}>
			        <span className={styles.submitButtons}>
			        <Button type="primary" htmlType="submit">
			        	查询
			        </Button>
			        <Button style={{ marginLeft: 8 }} onClick={this.handleFormReset}>
			        	重置
			        </Button>
			        <a style={{ marginLeft: 8 }} onClick={this.toggleForm}>
			        	展开 <Icon type="down" />
			        </a>
			        </span>
		        </Col>
	        </Row>
        </Form>
		);
	}

	renderAdvancedForm() {
		const {
			form: {
				getFieldDecorator
			},
			propoliceselect: {
				selectPoliceRankTree,
				selectDutyLevelTree,
				selectWorkTree,
				selectChangeTypeTree,
			},
		} = this.props;
		const parentPoliceRankTreeMethod = {
			dispatch: this.props.dispatch,
			requestModelName: this.state.requestModelName,
			selectedPoliceRankTreeValue: this.selectedPoliceRankTreeValue,
			selectPoliceRankTree,
			resetFlag: this.state.resetFlag
		}
		const parentDutyLevelTreeMethod = {
			dispatch: this.props.dispatch,
			requestModelName: this.state.requestModelName,
			selectedDutyLevelTreeValue: this.selectedDutyLevelTreeValue,
			selectDutyLevelTree,
			resetFlag: this.state.resetFlag
		}
		const parentWorkTreeMethod = {
			dispatch: this.props.dispatch,
			requestModelName: this.state.requestModelName,
			selectedWorkTreeValue: this.selectedWorkTreeValue,
			selectWorkTree,
			resetFlag: this.state.resetFlag
		}
		const parentChangeTypeTreeMethod = {
			dispatch: this.props.dispatch,
			requestModelName: this.state.requestModelName,
			selectedChangeTypeTreeValue: this.selectedChangeTypeTreeValue,
			selectChangeTypeTree,
			resetFlag: this.state.resetFlag
		}
		return(
			<Form onSubmit={this.handleSearch} layout="inline">
		      <Row gutter={{ md: 8, lg: 24, xl: 48 }}>
							<Col md={8} sm={24}>
						        <FormItem label="姓名">
						        	{getFieldDecorator('name')(<Input placeholder="请输入" />)}
								</FormItem>
						    </Col>
					      <Col md={8} sm={24}>
						        <FormItem label="拟授警衔">
						        	{getFieldDecorator('police_rank')(<SelectPoliceRankTree  {...parentPoliceRankTreeMethod}/>)}
										</FormItem>
					    	</Col>
					      <Col md={8} sm={24}>
						        <FormItem label="职务层次">
						        	{getFieldDecorator('duty_level')(<SelectDutyLevelTree  {...parentDutyLevelTreeMethod}/>)}
										</FormItem>
					    	</Col>
		    	</Row>
		      <Row gutter={{ md: 8, lg: 24, xl: 48 }}>
				      <Col md={8} sm={24}>
						        <FormItem label="单位">
						        	{getFieldDecorator('company')(<SelectWorkTree  {...parentWorkTreeMethod}/>)}
								</FormItem>
					    	</Col>
				      <Col md={8} sm={24}>
						        <FormItem label="变动类型">
						        	{getFieldDecorator('change_type')(<SelectChangeTypeTree  {...parentChangeTypeTreeMethod}/>)}
										</FormItem>
					    	</Col>
					    <Col md={8} sm={24}>
				        <FormItem label="人员记录">
				            {getFieldDecorator('ryjl')(
				                <Select placeholder="请选择" style={{ width: '100%' }}>
				                    <Option value="1">全部</Option>
				                    <Option value="0">重复</Option>
				                </Select>
				            )}
				        </FormItem>
			        </Col>
		    	</Row>
			    <div style={{ overflow: 'hidden' }}>
					<div style={{ marginBottom: 24 }}>
					<Button type="primary" htmlType="submit">
			        查询
			        </Button>
			        <Button style={{ marginLeft: 8 }} onClick={this.handleFormReset}>
			        重置
			        </Button>
			        <a style={{ marginLeft: 8 }} onClick={this.toggleForm}>
			        收起 <Icon type="up" />
			        </a>
		        	</div>
		        </div>
        </Form>
		);
	}

	renderForm() {
		const {
			expandForm
		} = this.state;

		return expandForm ? this.renderAdvancedForm() : this.renderSimpleForm();
	}

	render() {
		const steps = [
		  {
		    title: '系统筛选',
		  },
		  {
		    title: '核查',
		  },
		  {
		    title: '录入鉴定信息',
		  },
		  {
		    title: '确定人员',
		  },
		];
		const {
			propoliceselect: {
				data,
				selectDeptTree,
				selectOrganTree,
				selectStaffStatusTree,
				authForUser,
				postForUser
			},
			loading,
		} = this.props;
		const {
			selectedRows,
			modalVisible,
			updateModalVisible,
			viewModalVisible,
			updateFormValues,
			viewFormValues,
			addButtonVisible,

			current,
			modalVisibleBySystemSelect,
			modalVisibleByIdentifyInfo,
			modalVisibleByApplication,
			modalVisibleByMemberApprove,
			modalByCheck,
			checkflag
		} = this.state;


		const dataByCheckResult = [
		  {
		    key: '1',
		    index: '1',
		    name: '赵某',
		    check_result: '文化程度;没有培训;不一致',
		  },
		];

		//系统筛选
		const parentMethodsBySystemSelect = {
			handleModalVisibleBySystemSelect: this.handleModalVisibleBySystemSelect,
			handleAddBySystemSelect: this.handleAddBySystemSelect,
			modalVisibleBySystemSelect
		};
		//录入鉴定信息
		const parentMethodsByIdentifyInfo = {
			handleModalVisibleByIdentifyInfo: this.handleModalVisibleByIdentifyInfo,
			handleAddByIdentifyInfo: this.handleAddByIdentifyInfo,
			modalVisibleByIdentifyInfo
		};
		//生成请示花名册
		const parentMethodsByApplication = {
			handleModalVisibleByApplication: this.handleModalVisibleByApplication,
			handleAddByApplication: this.handleAddByApplication,
			modalVisibleByApplication
		};
		//生成审批表
		const parentMethodsByMemberApprove = {
			handleModalVisibleByMemberApprove: this.handleModalVisibleByMemberApprove,
			handleAddByMemberApprove: this.handleAddByMemberApprove,
			modalVisibleByMemberApprove
		};

		const parentMethods = {
			handleAdd: this.handleAdd,
			handleModalVisible: this.handleModalVisible,
			dispatch: this.props.dispatch,
			requestModelName: this.state.requestModelName,
			selectDeptTree,
			selectOrganTree,
			authForUser,
			postForUser
		};
		const updateMethods = {
			handleUpdateModalVisible: this.handleUpdateModalVisible,
			handleUpdate: this.handleUpdate,
			dispatch: this.props.dispatch,
			requestModelName: this.state.requestModelName,
			selectDeptTree,
			selectOrganTree,
			authForUser,
			postForUser
		};
		const viewMethods = {
			handleViewModalVisible: this.handleViewModalVisible
		};

		const menuCreate = (
		  <Menu>
		    <Menu.Item key="1" onClick={() => this.handleModalVisibleByApplication(true)}>
		      	请示和名册
		    </Menu.Item>
		    <Menu.Item key="2" onClick={() => this.handleModalVisibleByMemberApprove(true)}>
		   		审批表
		    </Menu.Item>
		  </Menu>
		);

		return(
			<PageHeaderWrapper title="人员筛选列表">
			<Modal
				width={600}
				centered
				destroyOnClose
				title="校验结果"
				visible={modalByCheck}
				onOk={()=> this.handleModalByCheck()}
				onCancel={()=> this.handleModalByCheck()}
				>
				<div className={styles.checkResult}>信息核查未通过结果</div>
				<Table columns={this.columnsByCheck} dataSource={dataByCheckResult}/>
			</Modal>
            <Card bordered={false}>
            <div className={styles.proUsertableList}>
            <div className={styles.proUsertableListForm}>{this.renderForm()}</div>
            <div className={styles.proUsertableListOperator}>
        	{/*<Button icon="plus" type="primary" onClick={() => this.handleModalVisible(true)}>
    		新增
    		</Button>*/}
        	    <Steps current={current} size="small" style={{width: '80%',marginBottom: '30px',marginTop: '10px'}}>
		          {steps.map(item => (
		            <Step key={item.title} title={item.title} />
		          ))}
		        </Steps>
        	<Button type="primary" onClick={() => this.handleModalVisibleBySystemSelect(true)} style={{marginRight: '25px'}}>
    		系统筛选
    		</Button>
        	<Button type="primary" onClick={() => this.handleModalVisibleByCheck(true)} style={{marginRight: '25px'}}>
    		核查
    		</Button>
        	<Button type="primary" onClick={() => this.handleModalVisibleByIdentifyInfo(true)} style={{marginRight: '25px'}}>
    		录入鉴定信息
    		</Button>
    		{/*<Dropdown overlay={menuCreate}>
		      <Button type="primary">
		        生成<Icon type="down" />
		      </Button>
		    </Dropdown>*/}
		    <Button type="primary" onClick={() => this.handleModalVisibleByDefinedMember(true)} style={{marginLeft: '0px'}}>
    			确定人员
    		</Button>
    	</div>
      {data != undefined && data.list.length > 0?(
        <Tabs type="card">
          {data.list.map(item => {
            return (
              <TabPane tab={item.title} key={item.key} closable={item.closable}>
              <StandardTable
                rowKey={"user_id"}
                selectedRows={selectedRows}
                loading={loading}
                data={item.children}
                columns={this.columns}
                onSelectRow={this.handleSelectRows}
                onChange={this.handleStandardTableChange}
                checkflag={ checkflag }
                />
              </TabPane>
            )
          })}

          </Tabs>
      ):(
          <StandardTable
          rowKey={"user_id"}
          selectedRows={selectedRows}
          loading={loading}
          data={[]}
          columns={this.columns}
          onSelectRow={this.handleSelectRows}
          onChange={this.handleStandardTableChange}
          checkflag={ checkflag }
          />
      )}

        </div>
        </Card>

        <ProUserCreateForm {...parentMethods} modalVisible={modalVisible} />

        {updateFormValues && Object.keys(updateFormValues).length ? (
            <ProUserUpdateForm
            {...updateMethods}
            updateModalVisible={updateModalVisible}
            values={updateFormValues}
            />
        ) : null}

        {viewFormValues && Object.keys(viewFormValues).length ? (
            <ProUserViewForm
            {...viewMethods}
            viewModalVisible={viewModalVisible}
            values={viewFormValues}
            />
        ) : null}

        <SystemSelectModal {...parentMethodsBySystemSelect}/>
        <IdentifyInfoModal {...parentMethodsByIdentifyInfo}/>
        <ApplicationModal {...parentMethodsByApplication}/>
        <MemberApproveModal {...parentMethodsByMemberApprove}/>

    </PageHeaderWrapper>
		);
	}
}

export default ProStaffSelectList;
